<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>以数组语法绑定style属性</title>
  <script type="text/javascript" src="vue.js"></script>
  <style>
    div>div {
      width: 60px;
      height: 60px;
      border: 2px solid #bbb;
      text-align: center;
      line-height: 60px;
      font-size: 30px;
      margin:10px;
      float:left;
    }
  </style>    
</head>
<body>
  <div id="app">
    <div>1</div>
    <div v-bind:style="[div2, divComputed3]">2</div>
    <div v-bind:style="[{ borderColor: '#000'}, divComputed3]">3</div>
    <div v-bind:style="divMethod4">4</div>
  </div>
  <script>
    var vm = new Vue({
      el: '#app',
      data:{
        div2: { 'border-color': '#000' },
        div3: { 'background': '#bbb' },
        div4: { borderColor: '#000', 'background': '#bbb' }
      },
      computed: {
        divComputed2() {
          return this.div2
        },
        divComputed3() {
          return this.div3
        },
      },
      methods: {
        divMethod4() {
          return this.div4
        }
      }
    })
  </script>
</body>
</html>